import request from './request'

export const add = (params) => {
	var beginTime = params.beginTime.split('-')
	var endTime = params.endTime.split('-')
	if(params.type != '按天') {
		var startHover = beginTime[2].split(' ')[1]
		var endHover = endTime[2].split(' ')[1]
	}else {
		var startHover = beginTime[2].split(' ')[1]=="上午"? '08:00':'14:00'
		var endHover = endTime[2].split(' ')[1]=="上午"? '11:30':'18:00'
	}
	params.beginTime = beginTime[0] + '年' + beginTime[1] + '月' + beginTime[2].split(' ')[0] + '日' + ' ' + startHover
	params.endTime = endTime[0] + '年' + endTime[1] + '月' + endTime[2].split(' ')[0] + '日' + ' ' + endHover
  return request.post('/zxch/workover/app',params)
}

export const getList = (params) => {
  return request.get('/zxch/workover/app/list',params)
}

export const getJBInfo = (id) => {
  return request.get(`/zxch/workover/app/${id}`)
}

export const revokeJB = (id) => {
  return request.put(`/zxch/workover/app/revoke/${id}`)
}